{include file="public/head"/} 
  <body>
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a><cite>后台管理</cite></a>
        <a><cite>停车场地管理中心</cite></a>
        <a><cite>停车账单管理</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:window.location.reload();" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>
    <div class="x-body">
      <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so"  method="get" action="#">


          <input type="text" name="parkingNume"  placeholder="停车场" autocomplete="off" class="layui-input" value="{if isset($parkingNume)}{$parkingNume}{/if}">
          <input type="text" name="plateNumber"  placeholder="车牌号码" autocomplete="off" class="layui-input" value="{if isset($plateNumber)}{$plateNumber}{/if}">

		 
<!--          <div class="layui-input-inline">-->
<!--            <select name="payType">-->
<!--				<option value="">付款方式</option>-->
<!--				<option value="1" {if isset($payType)}{if $payType == '1'}selected{/if}{/if}>支付宝扫码</option>-->
<!--				<option value="2" {if isset($payType)}{if $payType == '2'}selected{/if}{/if}>微信扫码</option>-->
<!--				<option value="8" {if isset($payType)}{if $payType == '8'}selected{/if}{/if}>支付宝预交费</option>-->
<!--				<option value="9" {if isset($payType)}{if $payType == '9'}selected{/if}{/if}>微信预交费</option>-->
<!--                &lt;!&ndash;<option value="cash" {if isset($payType)}{if $payType == 'cash'}selected{/if}{/if}>现金</option>&ndash;&gt;-->
<!--                <option value="3" {if isset($payType)}{if $payType == '3'}selected{/if}{/if}>优惠券</option>-->
<!--                <option value="10" {if isset($payType)}{if $payType == '10'}selected{/if}{/if}>停车优惠券</option>-->
<!--                <option value="4" {if isset($payType)}{if $payType == '4'}selected{/if}{/if}>城市大脑扣款</option>-->
<!--                <option value="5" {if isset($payType)}{if $payType == '5'}selected{/if}{/if}>支付宝代扣</option>-->
<!--                <option value="6" {if isset($payType)}{if $payType == '6'}selected{/if}{/if}>储值车</option>-->
<!--                <option value="7" {if isset($payType)}{if $payType == '7'}selected{/if}{/if}>福利车</option>-->

<!--            </select>-->
<!--          </div>-->

<!--          <input type="text" class="layui-input" id="test5" name="start_time" placeholder="开始时间" {if isset($start_time)}value="{$start_time}"{/if}>-->
<!--          <input type="text" class="layui-input" id="test6" name="end_time" placeholder="结束时间" {if isset($end_time)}value="{$end_time}"{/if}>-->
<!--          -->
            <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
          <!-- <button type="reset" class="layui-btn"><i class="layui-icon">&#xe639;</i></button> -->
        </form>
      </div>
      <xblock>
	  <button class="layui-btn" onclick="orderDump('{$export}')"><i class="layui-icon"></i>批量导出</button>&nbsp;&nbsp;&nbsp;&nbsp;
<!--      <button class="layui-btn layui-btn-danger" onclick="delAll()"><i class="layui-icon"></i>批量删除</button>-->

      <span class="x-right" style="line-height:40px">共有数据：{$number} 条</span>
      </xblock>
      <table class="layui-table" id="table">
        <thead>
          <tr>
              <th style="text-align: center; font-size: 16px;">
                  <div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div>
              </th>
              <th style="text-align: center; font-size: 16px; height: 30px;">ID</th>
              <th style="text-align: center; font-size: 16px; height: 30px;">停车场</th>

              <th style="text-align: center; font-size: 16px;">车牌号码</th>
            <th style="text-align: center; font-size: 16px;">应收金额</th>
			<th style="text-align: center; font-size: 16px;">实收金额</th>
            <th style="text-align: center; font-size: 16px;">付款方式</th>
            <th style="text-align: center; font-size: 16px;">外部订单号</th>
              <th style="text-align: center; font-size: 16px;">订单号</th>

            <th style="text-align: center; font-size: 16px;">入场时间</th>
            <th style="text-align: center; font-size: 16px;">出场时间</th>
            <th style="text-align: center; font-size: 16px;">停车时长</th>
              <th style="text-align: center; font-size: 16px;">缴费时间</th>
          </tr>
        </thead>
        <tbody>
          {foreach $list as $lis}
          <tr>
              <td style="text-align: center;">
                  <div class="layui-unselect layui-form-checkbox" lay-skin="primary" ><i class="layui-icon">&#xe605;</i></div>
              </td>
			<td style="text-align: center;">{$lis.id}</td>
              <td style="text-align: center;">{$lis.parkingNume}</td>

            <td style="text-align: center;">{$lis.plateNumber}</td>
            <td style="text-align: center;">{$lis.amount}</td>
            
            <td style="text-align: center;">{$lis.amount}</td>
            <td style="text-align: center;">
                {if $lis.payType=="2"}微信{/if}
                {if $lis.payType=="3"}支付宝{/if}
			</td>
              <td style="text-align: center;">{$lis.out_trade_no}</td>
              <td style="text-align: center;">{$lis.trade_no}</td>


			<td style="text-align: center;">
                {$lis.inTime}
			</td>
			<td style="text-align: center;">
                {$lis.outTime}
			</td>
            <td style="text-align: center;">
                {$lis.duration}
			</td>
              <td style="text-align: center;">
                  {$lis.createTime}
              </td>

           
          </tr>
          {/foreach}
        </tbody>
      </table>
      <div class="page">
        <div>
            {$orderlist->render()|raw}
        </div>
      </div>

    </div>
    <script>
        //批量删除
        function delAll () {
            var datas = $('#table tbody td .layui-form-checked')
            var ids = []
            datas.each(function(index, element){
                var id = $(this).data('id')
                ids.push(id)
            })

            var str = ids.join(',');
            var count = ids.length
            console.log(str);
            //window.location.href='{:url("orderDelAll")}?id='+str;
            //return ;
            layer.confirm('你确定要删除这'+ count + '项吗', function(){
                $.post('{:url("orderDelAll")}', { id: str}, function(r){
                    if (r.info) {
                        layer.msg(r.info)
                        location.reload()
                    }else{
                        layer.msg(r.error)
                        location.reload()
                    }
                })
            })
        }
        layui.use(['form'], function() {
            form=layui.form;
            form.on('select(parkingNo)', function(data){
                var val=data.value;
                console.log(val);
                if(val==""){
                    $('#clientNo').html("<option value=''>客户端</option>");
                    form.render('select')
                }else{
                    var url = "{:url('order/getClient')}"
                    $.post(url, {parkingNo:val}, function(res) {
                        console.log(res);
                        $('#clientNo').html(res);
                        form.render('select')
                    },'html')
                }
            });
        })
		layui.use('laydate', function() {
            var laydate = layui.laydate;
            //日期时间选择器
            laydate.render({
                elem: '#test5'
                ,type: 'datetime'
            });
            //日期时间选择器
            laydate.render({
                elem: '#test6'
                ,type: 'datetime'
            });
        });
      //删除
      function orderDel(id, doc){
        if(confirm('确定要删除吗?')) 
        { 
          var url = "{:url('orderDel')}?id=" + id
          // console.log(url)
          $('#' + doc).attr('href', url)
        } 
          return false; 
      } 
      
	  //批量导出
      function orderDump(exportid){
          var url = "{:url('orderExcel')}?&export=" + exportid;
          layer.open({
              type: 2,
              title: '批量导出账单',
              shadeClose: true,
              shade: 0.8,
              area: ['60%', '60%'],
              content: url //iframe的url
          });
      }

    </script>
    <script>var _hmt = _hmt || []; (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
      })();
    </script>
  </body>

</html>